import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import axios from 'axios'
import http from './ajax/http'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
Vue.use(ElementUI);
http.defaults.baseURL='/api'
axios.defaults.baseURL = '/api/mock/48'
Vue.config.productionTip = false
Vue.prototype.$axios = http

//每一次路由跳转前
/*router.beforeEach((to,from,next)=>{
  if(to.meta.isLogin){
    //需要登录
    //判断系统是否登录
    if(store.state.user.userName){
      //为true，代表登陆了
      if(to.meta.roles.indexOf(store.state.user.type) >= 0){
        next()
      }else {
        alert('你没有权限操作当前点击页面')
        next('/index')
        //也可以退出重新登录
      }
    }else {
      alert('登录失败，请重新输入')
      router.push('/login')
    }
  }else {
    next()
  }
})*/



new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
